package com.hc.ex;


import com.hc.common.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 全局异常
 *
 * @author hecai
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class GlobalException extends RuntimeException {

    /**
     * 异常错误代码
     */
    private Integer code;
    /**
     * 异常信息
     */
    private String msg;

    public GlobalException(String msg) {
        this.msg = msg;
    }

    public GlobalException(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMsg();
    }

}
